﻿using System;
using System.Collections.Generic;

namespace Avalon.Core.MVC.StateBags {
    public class EntityBag<TModel> : IEntityBag<TModel> {
        private Exception mError;
        public TModel Model { get; set; }
        public Dictionary<string, object> ParameterValues { get; set; }
        public Exception Error {
            get { return mError; }
            set {
                mError = value;
            }
        }

        public dynamic Result {
            get {
                return this.Model;
            }
            set {
                this.Model = value;
            }
        }

        public EntityBag() {
            ParameterValues = new Dictionary<string, object>();
        }
        public EntityBag(TModel pModel)
            : this() {
            this.Model = pModel;
        }
    }
}
